﻿<Window x:Class="FR.SAFTAnalyser.MainWindowView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:views="clr-namespace:FR.SAFTAnalyser.Views"
        xmlns:tools="clr-namespace:FR.SAFTAnalyser.Views.Tools"
        xmlns:avalonDock="http://avalondock.codeplex.com"
        xmlns:pane="clr-namespace:FR.SAFTAnalyser.ViewModels.Pane"
        xmlns:conv="clr-namespace:FR.SAFTAnalyser.ValueConverters"
        xmlns:cmd="clr-namespace:FR.SAFTAnalyser"
        Title="{Binding Title}" Icon="{StaticResource App}" 
        WindowStyle="SingleBorderWindow"
        WindowState="Maximized" WindowStartupLocation="CenterScreen">

    <Window.Resources>
        <conv:ActiveDocumentConverter x:Key="ActiveDocumentConverter"/>
        <avalonDock:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
    </Window.Resources>

    <DockPanel>
        <StatusBar Height="30" DockPanel.Dock="Bottom">
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Tema: "/>
                    <ComboBox x:Name="ComboTheme" SelectedIndex="{Binding ThemeID, Mode=TwoWay}" Grid.Row="6" Grid.Column="1">
                        <ComboBoxItem Content="Generic" />
                        <ComboBoxItem Content="Aero">
                            <ComboBoxItem.Tag>
                                <avalonDock:AeroTheme />
                            </ComboBoxItem.Tag>
                        </ComboBoxItem>
                        <ComboBoxItem Content="VS2010">
                            <ComboBoxItem.Tag>
                                <avalonDock:VS2010Theme />
                            </ComboBoxItem.Tag>
                        </ComboBoxItem>
                        <ComboBoxItem Content="Metro">
                            <ComboBoxItem.Tag>
                                <avalonDock:MetroTheme />
                            </ComboBoxItem.Tag>
                        </ComboBoxItem>
                        <ComboBoxItem Content="Express Dark">
                            <ComboBoxItem.Tag>
                                <avalonDock:ExpressionDarkTheme />
                            </ComboBoxItem.Tag>
                        </ComboBoxItem>
                        <ComboBoxItem Content="Express Light">
                            <ComboBoxItem.Tag>
                                <avalonDock:ExpressionLightTheme />
                            </ComboBoxItem.Tag>
                        </ComboBoxItem>
                    </ComboBox>
                </StackPanel>
            </StatusBarItem>
            <Separator />
            <StatusBarItem>
                <TextBlock Text="{Binding MensagemStatus}"/>
            </StatusBarItem>
            <Separator />
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="SAF-T: "/>
                    <TextBlock Text="{Binding VersaoSAFT}"/>
                    <TextBlock Text=" "/>
                    <TextBlock Text="{Binding FicheiroSAFT}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator />
            <StatusBarItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Stocks: "/>
                    <TextBlock Text="{Binding VersaoSTOCK}"/>
                    <TextBlock Text=" "/>
                    <TextBlock Text="{Binding FicheiroSTOCK}"/>
                </StackPanel>
            </StatusBarItem>
            <Separator />
            <StatusBarItem>
                <TextBlock>
                    <Hyperlink Command="{Binding DoOpenMainWebSiteCommand}">
                        <TextBlock Text="{Binding MainWebSite}"/>
                    </Hyperlink>
                </TextBlock>
            </StatusBarItem>
        </StatusBar>

        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_SAF-T">
                <MenuItem Header="Abrir SAF-T PT" Command="cmd:AppCommand.LoadSAFT">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource Open}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Abrir chave privada" Command="cmd:AppCommand.LoadPrivateKeyFile">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource Lock}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Abrir chave pública" Command="cmd:AppCommand.LoadPublicKeyFile" >
                    <MenuItem.Icon>
                        <Image Source="{StaticResource UnLock}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Abrir existências" Command="cmd:AppCommand.LoadStockFile" >
                    <MenuItem.Icon>
                        <Image Source="{StaticResource Stocks}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Opções" Command="{Binding SettingsCommand}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource Settings}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator/>
                <MenuItem Header="Sair" Command="cmd:AppCommand.Exit" />
            </MenuItem>
            <MenuItem Header="_Ferramentas">
                <MenuItem Header="Tabelas" IsChecked="{Binding SaftParts.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
                <MenuItem Header="Erros" IsChecked="{Binding ErrorMessages.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
                <MenuItem Header="Ferramentas" IsChecked="{Binding ConvertPemKey.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
                <MenuItem Header="Guardar BD" IsChecked="{Binding SaveBD.IsVisible, Mode=TwoWay}" IsCheckable="True"/>
            </MenuItem>
            <MenuItem Header="_Ajuda">
                <MenuItem Header="Sobre" Command="{Binding AboutCommand}">
                    <MenuItem.Icon>
                        <Image Source="{StaticResource App}" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>

        <avalonDock:DockingManager
            DockPanel.Dock="Top"
            x:Name="dockManager"
            AnchorablesSource="{Binding Tools}"
            DocumentsSource="{Binding DocumentParts}"
            ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={StaticResource ActiveDocumentConverter}}"
            Theme="{Binding ElementName=ComboTheme, Path=SelectedItem.Tag}"
            Grid.Row="2">

            <!-- header template -->
            <avalonDock:DockingManager.DocumentHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Padding="3" />
                    </StackPanel>
                </DataTemplate>
            </avalonDock:DockingManager.DocumentHeaderTemplate>

            <avalonDock:DockingManager.LayoutItemTemplateSelector>
                <pane:PanesTemplateSelector>
                    <pane:PanesTemplateSelector.SaftViewTemplate>
                        <DataTemplate>
                            <views:SaftView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.SaftViewTemplate>
                    <pane:PanesTemplateSelector.CustomersViewTemplate>
                        <DataTemplate>
                            <views:CustomersView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.CustomersViewTemplate>
                    <pane:PanesTemplateSelector.GeneralLedgerEntriesViewTemplate>
                        <DataTemplate>
                            <views:GeneralLedgerEntriesView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.GeneralLedgerEntriesViewTemplate>
                    <pane:PanesTemplateSelector.GeneralLedgerViewTemplate>
                        <DataTemplate>
                            <views:GeneralLedgerView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.GeneralLedgerViewTemplate>
                    <pane:PanesTemplateSelector.HeaderViewTemplate>
                        <DataTemplate>
                            <views:HeaderView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.HeaderViewTemplate>
                    <pane:PanesTemplateSelector.InvoicesSummaryViewTemplate>
                        <DataTemplate>
                            <views:InvoicesSummaryView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.InvoicesSummaryViewTemplate>
                    <pane:PanesTemplateSelector.InvoicesViewTemplate>
                        <DataTemplate>
                            <views:InvoicesView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.InvoicesViewTemplate>
                    <pane:PanesTemplateSelector.InvoiceViewTemplate>
                        <DataTemplate>
                            <views:InvoiceView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.InvoiceViewTemplate>
                    <pane:PanesTemplateSelector.PaymentsViewTemplate>
                        <DataTemplate>
                            <views:PaymentsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.PaymentsViewTemplate>
                    <pane:PanesTemplateSelector.WorkingDocumentsViewTemplate>
                        <DataTemplate>
                            <views:WorkingDocumentsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.WorkingDocumentsViewTemplate>
                    <pane:PanesTemplateSelector.MovementOfGoodsViewTemplate>
                        <DataTemplate>
                            <views:MovementOfGoodsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.MovementOfGoodsViewTemplate>
                    <pane:PanesTemplateSelector.ProductsViewTemplate>
                        <DataTemplate>
                            <views:ProdutsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.ProductsViewTemplate>
                    <pane:PanesTemplateSelector.SuppierViewTemplate>
                        <DataTemplate>
                            <views:SupplierView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.SuppierViewTemplate>
                    <pane:PanesTemplateSelector.TaxViewTemplate>
                        <DataTemplate>
                            <views:TaxView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.TaxViewTemplate>
                    
                    <!-- Stocks -->
                    <pane:PanesTemplateSelector.StockHeaderTemplate>
                        <DataTemplate>
                            <views:StockHeaderView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.StockHeaderTemplate>
                    <pane:PanesTemplateSelector.StockProductsTemplate>
                        <DataTemplate>
                            <views:StocksProdutsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.StockProductsTemplate>
                    
                    <!-- tools -->
                    <pane:PanesTemplateSelector.ConvertPemKeyTemplate>
                        <DataTemplate>
                            <tools:ConvertPemKeyView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.ConvertPemKeyTemplate>
                    <pane:PanesTemplateSelector.ErrorMessagesViewTemplate>
                        <DataTemplate>
                            <tools:ErrorMessagesView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.ErrorMessagesViewTemplate>
                    <pane:PanesTemplateSelector.SaftPArtsViewTemplate>
                        <DataTemplate>
                            <tools:DocumentPartsView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.SaftPArtsViewTemplate>
                    <pane:PanesTemplateSelector.SaveBDTemplate>
                        <DataTemplate>
                            <tools:SaveToBDView />
                        </DataTemplate>
                    </pane:PanesTemplateSelector.SaveBDTemplate>
                    <pane:PanesTemplateSelector.CreateHashFromUserInputTemplate>
                        <DataTemplate>
                            <tools:CreateHashFromUserInputView/>
                        </DataTemplate>
                    </pane:PanesTemplateSelector.CreateHashFromUserInputTemplate>
                </pane:PanesTemplateSelector>
            </avalonDock:DockingManager.LayoutItemTemplateSelector>

            <avalonDock:DockingManager.LayoutItemContainerStyleSelector>
                <pane:PanesStyleSelector>
                    <pane:PanesStyleSelector.SaftStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Ficheiros SAF-T PT"/>
                            <Setter Property="CanClose" Value="False"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.SaftStyle>
                    <pane:PanesStyleSelector.CustomersStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Tabela de clientes"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.CustomersStyle>
                    <pane:PanesStyleSelector.GeneralLedgerEntriesStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Movimentos contabilísticos"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.GeneralLedgerEntriesStyle>
                    <pane:PanesStyleSelector.GeneralLedgerStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Tabela de código de contas"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.GeneralLedgerStyle>
                    <pane:PanesStyleSelector.HeaderStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="CanClose" Value="False"/>
                            <Setter Property="ToolTip" Value="Informações do ficheiro e da empresa"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.HeaderStyle>
                    <pane:PanesStyleSelector.InvoicesStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Documentos comerciais a clientes"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.InvoicesStyle>
                    <pane:PanesStyleSelector.InvoiceStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Detalhes Documento"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.InvoiceStyle>
                    <pane:PanesStyleSelector.PaymentsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Documentos de recibos emitidos"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.PaymentsStyle>
                    <pane:PanesStyleSelector.WorkingDocumentsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Documentos de conferência de entrega de mercadorias ou da prestação de serviços"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.WorkingDocumentsStyle>
                    <pane:PanesStyleSelector.MovementOfGoodsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Documentos de movimentação de mercadorias"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.MovementOfGoodsStyle>
                    <pane:PanesStyleSelector.InvoicesSummaryStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Resumo dos documentos de facturação"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.InvoicesSummaryStyle>
                    <pane:PanesStyleSelector.ProductsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Tabela de produtos"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.ProductsStyle>
                    <pane:PanesStyleSelector.SuppierStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Tabela de fornecedores"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.SuppierStyle>
                    <pane:PanesStyleSelector.TaxStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Tabela de impostos"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.TaxStyle>

                    <!-- stocks -->
                    <pane:PanesStyleSelector.StockHeaderStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Cabeçalho existências"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.StockHeaderStyle>
                    <pane:PanesStyleSelector.StockProductsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Stocks produtos"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.StockProductsStyle>
                    <!-- tools -->
                    <pane:PanesStyleSelector.ErrorMessagesStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Listagem de erros"/>
                            <Setter Property="CanClose" Value="False"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.ErrorMessagesStyle>
                    <pane:PanesStyleSelector.SaftPartsStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="SAF-T PT"/>
                            <Setter Property="CanClose" Value="False"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.SaftPartsStyle>
                    <pane:PanesStyleSelector.ConvertPemKeyStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Ferramentas de conversão"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.ConvertPemKeyStyle>
                    <pane:PanesStyleSelector.SaveBDStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Guardar ficheiro BD"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.SaveBDStyle>
                    <pane:PanesStyleSelector.CreateHashFromUserInputStyle>
                        <Style TargetType="{x:Type avalonDock:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.Title}"/>
                            <Setter Property="ToolTip" Value="Criar Hash"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                        </Style>
                    </pane:PanesStyleSelector.CreateHashFromUserInputStyle>
                </pane:PanesStyleSelector>
            </avalonDock:DockingManager.LayoutItemContainerStyleSelector>
            <avalonDock:DockingManager.LayoutUpdateStrategy>
                <pane:LayoutInitializer/>
            </avalonDock:DockingManager.LayoutUpdateStrategy>

            <avalonDock:LayoutRoot>
                <avalonDock:LayoutPanel Orientation="Vertical">
                    <avalonDock:LayoutDocumentPane/>
                    <avalonDock:LayoutAnchorablePane DockHeight="350" />
                </avalonDock:LayoutPanel>
            </avalonDock:LayoutRoot>
        </avalonDock:DockingManager>

    </DockPanel>
</Window>
